﻿using SharpHook.Native;

namespace KMSimulator.Utils
{
    public class KeyUtils
    {
        /// <summary>
        /// 字符串KeyCode
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static KeyCode GetKeyCode(string key)
        {
            switch (key)
            {
                case "Escape":
                    return KeyCode.VcEscape;
                case "F1":
                    return KeyCode.VcF1;
                case "F2":
                    return KeyCode.VcF2;
                case "F3":
                    return KeyCode.VcF3;
                case "F4":
                    return KeyCode.VcF4;
                case "F5":
                    return KeyCode.VcF5;
                case "F6":
                    return KeyCode.VcF6;
                case "F7":
                    return KeyCode.VcF7;
                case "F8":
                    return KeyCode.VcF8;
                case "F9":
                    return KeyCode.VcF9;
                case "F10":
                    return KeyCode.VcF10;
                case "F11":
                    return KeyCode.VcF11;
                case "F12":
                    return KeyCode.VcF12;
                case "D0":
                    return KeyCode.Vc0;
                case "D1":
                    return KeyCode.Vc1;
                case "D2":
                    return KeyCode.Vc2;
                case "D3":
                    return KeyCode.Vc3;
                case "D4":
                    return KeyCode.Vc4;
                case "D5":
                    return KeyCode.Vc5;
                case "D6":
                    return KeyCode.Vc6;
                case "D7":
                    return KeyCode.Vc7;
                case "D8":
                    return KeyCode.Vc8;
                case "D9":
                    return KeyCode.Vc9;
                case "OemMinus":
                    return KeyCode.VcMinus;
                case "Oemplus":
                    return KeyCode.VcEquals;
                case "Back":
                    return KeyCode.VcBackspace;
                case "Tab":
                    return KeyCode.VcTab;
                case "Capital":
                    return KeyCode.VcCapsLock;
                case "A":
                    return KeyCode.VcA;
                case "B":
                    return KeyCode.VcB;
                case "C":
                    return KeyCode.VcC;
                case "D":
                    return KeyCode.VcD;
                case "E":
                    return KeyCode.VcE;
                case "F":
                    return KeyCode.VcF;
                case "G":
                    return KeyCode.VcG;
                case "H":
                    return KeyCode.VcH;
                case "I":
                    return KeyCode.VcI;
                case "J":
                    return KeyCode.VcJ;
                case "K":
                    return KeyCode.VcK;
                case "L":
                    return KeyCode.VcL;
                case "M":
                    return KeyCode.VcM;
                case "N":
                    return KeyCode.VcN;
                case "O":
                    return KeyCode.VcO;
                case "P":
                    return KeyCode.VcP;
                case "Q":
                    return KeyCode.VcQ;
                case "R":
                    return KeyCode.VcR;
                case "S":
                    return KeyCode.VcS;
                case "T":
                    return KeyCode.VcT;
                case "U":
                    return KeyCode.VcU;
                case "V":
                    return KeyCode.VcV;
                case "W":
                    return KeyCode.VcW;
                case "X":
                    return KeyCode.VcX;
                case "Y":
                    return KeyCode.VcY;
                case "Z":
                    return KeyCode.VcZ;
                case "OemOpenBrackets": //[
                    return KeyCode.VcOpenBracket;
                case "Oem6": //]
                    return KeyCode.VcCloseBracket;
                case "Oem5": //\
                    return KeyCode.VcBackslash;
                case "Oem1": //;
                    return KeyCode.VcSemicolon;
                case "Oem7": //'
                    return KeyCode.VcQuote;
                case "Return": // 回车
                    return KeyCode.VcEnter;
                case "Oemcomma": // <
                    return KeyCode.VcComma;
                case "OemPeriod": // >
                    return KeyCode.VcPeriod;
                case "OemQuestion": // >
                    return KeyCode.VcQuestion;
                case "Insert":
                    return KeyCode.VcInsert;
                case "Delete":
                    return KeyCode.VcDelete;
                case "Home":
                    return KeyCode.VcHome;
                case "End":
                    return KeyCode.VcEnd;
                case "PageUp":
                    return KeyCode.VcPageUp;
                case "PageDown":
                    return KeyCode.VcPageDown;
                case "Up":
                    return KeyCode.VcUp;
                case "Left":
                    return KeyCode.VcLeft;
                case "Right":
                    return KeyCode.VcRight;
                case "Down":
                    return KeyCode.VcDown;
                case "Pause":
                    return KeyCode.VcPause;
                case "NumLock":
                    return KeyCode.VcNumLock;
                case "Divide":
                    return KeyCode.VcNumPadDivide;
                case "Multiply":
                    return KeyCode.VcNumPadMultiply;
                case "Subtract":
                    return KeyCode.VcNumPadSubtract;
                case "Add":
                    return KeyCode.VcNumPadAdd;
                case "Decimal":
                    return KeyCode.VcNumPadDecimal;
                case "NumPad0":
                    return KeyCode.VcNumPad0;
                case "NumPad1":
                    return KeyCode.VcNumPad1;
                case "NumPad2":
                    return KeyCode.VcNumPad2;
                case "NumPad3":
                    return KeyCode.VcNumPad3;
                case "NumPad4":
                    return KeyCode.VcNumPad4;
                case "NumPad5":
                    return KeyCode.VcNumPad5;
                case "NumPad6":
                    return KeyCode.VcNumPad6;
                case "NumPad7":
                    return KeyCode.VcNumPad7;
                case "NumPad8":
                    return KeyCode.VcNumPad8;
                case "NumPad9":
                    return KeyCode.VcNumPad9;
                case "VolumeMute":
                    return KeyCode.VcVolumeMute;
                case "VolumeUp":
                    return KeyCode.VcVolumeUp;
                case "VolumeDown":
                    return KeyCode.VcVolumeDown;
                case "Ctrl":
                    return KeyCode.VcLeftControl;
                case "Alt":
                    return KeyCode.VcLeftAlt;
                case "Shift":
                    return KeyCode.VcLeftShift;
                case "Space":
                    return KeyCode.VcSpace;
                default:
                    return KeyCode.VcUndefined;
            }
        }
    }
}
